const app = new Vue({
    el: "#app",
    data() {
        return {
            formData: {
                serverConfigList: [],
                mirrorNetworkCardInfoList: [],
            },
            typeMap: {
                '1': '镜像口',
                '2': '出包口',
            }
        }
    },
    methods: {
        addTableRow(listName, row = {}) {
            this.formData[listName].push(row);
        },
        deleteTableRow(listName, idx) {
            this.formData[listName].splice(idx, 1);
        },
        async initInfo() {
            this.formData = await sysServerConfigApi.getInfo();
        },
        async submit() {
            const res = await this.$validator.validateAll()
            if (res) {
                const result = await sysServerConfigApi.add(this.formData)
                if (result.code === 200) {
                    await rxPrompt.msg('保存成功!')
                } else {
                    await rxPrompt.msg(`保存失败,${result.msg}`)
                }
            } else {
                await rxPrompt.dangerMsg("输入存在错误！");
            }
        }
    },
    computed: {},
    async created() {
        await this.initInfo();
    }

})
